/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Alvaro
 */
@Entity
@Table(name = "company_folder_type")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CompanyFolderType.findAll", query = "SELECT c FROM CompanyFolderType c"),
    @NamedQuery(name = "CompanyFolderType.findByIdCompanyFolderType", query = "SELECT c FROM CompanyFolderType c WHERE c.idCompanyFolderType = :idCompanyFolderType"),
    @NamedQuery(name = "CompanyFolderType.findByDescription", query = "SELECT c FROM CompanyFolderType c WHERE c.description = :description")})
public class CompanyFolderType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_COMPANY_FOLDER_TYPE")
    private Integer idCompanyFolderType;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "DESCRIPTION")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "companyFolderType")
    private List<CompanyFolder> companyFolderList;

    public CompanyFolderType() {
    }

    public CompanyFolderType(Integer idCompanyFolderType) {
        this.idCompanyFolderType = idCompanyFolderType;
    }

    public CompanyFolderType(Integer idCompanyFolderType, String description) {
        this.idCompanyFolderType = idCompanyFolderType;
        this.description = description;
    }

    public Integer getIdCompanyFolderType() {
        return idCompanyFolderType;
    }

    public void setIdCompanyFolderType(Integer idCompanyFolderType) {
        this.idCompanyFolderType = idCompanyFolderType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public List<CompanyFolder> getCompanyFolderList() {
        return companyFolderList;
    }

    public void setCompanyFolderList(List<CompanyFolder> companyFolderList) {
        this.companyFolderList = companyFolderList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCompanyFolderType != null ? idCompanyFolderType.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CompanyFolderType)) {
            return false;
        }
        CompanyFolderType other = (CompanyFolderType) object;
        if ((this.idCompanyFolderType == null && other.idCompanyFolderType != null) || (this.idCompanyFolderType != null && !this.idCompanyFolderType.equals(other.idCompanyFolderType))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.CompanyFolderType[ idCompanyFolderType=" + idCompanyFolderType + " ]";
    }
    
}
